{use master_page('admin/v_master')} 
{block content} 
<?php 
$cu_group = $this->usergroup_manager->get($this->current_user()->usergroup_id);  
?>
<script>
$(document).ready(function(){
	$('#type').change(function(){
		var v = $(this).val(); 
		<?
		$get_type = array_remove($_GET, 'type');
		$get_params = Array();
		foreach($_GET as $k=>$v)
		{
			$get_params[] = "$k=$v";
		}
		$get_params_str = implode('&',$get_params);
		?>
		var url = '<?=_U("article/index?")?><?=$get_params_str?>&type=' + v;
		//alert(url);
		//window.open(url);
		window.location.href = url ;  
	}) ;

	$("#chkall").click(function(){
		var checked = $(this).attr("checked");
		$(".datatable tbody input[type=checkbox]").attr("checked",checked) ;  
	}) ; 
	
})
</script>
<!-- div class="line w_long" style="border:1px solid #c0c0c0;margin-bottom:10px">
	<div class="left" style="border:0px solid black">
		<strong>
			<a href="http://localhost/jr_cms/admin.php/entry/index">首页</a> >网站文章管理
		</strong>
	</div>
	<div class="right btn"> 
		<a href="<?=_U("article/edit?class_id=").$this->input->get('class-id')?>">添加文章</a> 
	</div>
</div -->
<div class="line">  
<form id = 'form1' action = '<?=$_SERVER['REQUEST_URI']?>' method='post'>
	<div class="blank5" style="height:10px;"></div>
	<?php if($cu_group->permission("article","edit")):?>
	<div style="padding-left:10px;">
		<input style="width:132px;height:38px;line-height:38px;color:white;background:url(images/btn_03.gif) left top no-repeat;border:none; text-align:center;
 			 cursor: pointer;" class="btn_c" type="button" value=" 添加文章 " 
 			 onclick="javascript:window.location.href='<?=_U("article/edit?tab=article_manager&class_id=").$this->input->get('class-id')?>'">
	</div>
	<?php endif;?>
	<div class="blank5" style="height:10px;"></div>
	<div id="tagscontent" class="right_box">
		<table class="datatable" >
			<thead>
				<tr>
					<th >
					<input title="点击可全选本页的所有项目" type="checkbox" id="chkall">
					</th> 
					<th width="100px"><?=lang('article_class')?></th>
					<th><?=lang('article_title')?></th>
					<th width="120px"><?=lang('article_author')?></th>
					<th width="48px;"><?=lang('article_click_count')?></th>
					<th width="88px"><?=lang('article_contribute_time')?></th>
					<th width="66">操作</th>
				</tr>
			</thead>
		<tbody>
			<?php foreach($articles as $article):?>
			<tr> 
				<td style="width:31px;">
					<input type="checkbox" value="<?php echo $article->id;?>"  name="ids[]">
				</td>
				<td align="center">{article->class->title}</td> 
				<td align="left"><?=mb_substr($article->title,0,15,'UTF8')?>...</td> 
				<td align="center">{article->author}</td>
				<td align="center">{article->click_count}</td> 
				<td align="center">{article->contribute_time}</td> 
				<td>
					<?php if($cu_group->permission("article","edit")):?>
					<a class="edit" onmouseover="tooltip.show('编辑');" onmouseout="tooltip.hide();" href="<?=_U('article/edit?tab=article_manager&id=')?>{article->id}&class_id=<?=!empty($_GET['class-id'])?$this->input->get('class-id'):$article->class_id;?>">
					</a>
					<?php endif;?> 
					<?php if($cu_group->permission("article","del")):?>
					<a class="delete"  onmouseover="tooltip.show('删除');" onmouseout="tooltip.hide();" onclick="javascript:return confirm('确认删除');" href="<?=_U('article/del/')?>{article->id}">
					</a>
					<?php endif;?> 
				</td>
			</tr>
			<?php endforeach;?>
			<tr>
				<td colspan='7' style="padding:5px 0px;text-align:center">
					<? $this->load->view('admin/v_pager',$sp_config); ?>
				</td>
			</tr>
		</tbody>
	</table>
	</div>
<script>
$(document).ready(function(){
	$('#btn_delete').click(function(){
		var frm = $("#form1");
		frm.attr('action','<?php echo _U("article/del");?>'); 
		frm.submit();
	});
});
</script>
	<div class="blank10" style="height:10px"></div>
	<?php if($cu_group->permission("article","del")):?>
	<input class="btn_d" type="button" value=" 删除 " id="btn_delete">
	<?php endif;?> 
</form>
</div>
{end} 